(use-modules
 ;; SRFI 64 for unit testing facilities
 (srfi srfi-64)
 ;; utils - the code to be tested
 (utils display))


(test-begin "display-utils-test")


(test-group
 "displayln"
 ;; if this test fails, then the gini index of perfect split is not 0.0
 (test-equal "displayln with empty string should ee a newline"
   "\n"
   (call-with-output-string
     (lambda (port)
       (displayln "" port))))

 (test-equal "displayln with normal message"
   "Hello!\n"
   (call-with-output-string
     (lambda (port)
       (displayln "Hello!" port))))

 (test-equal "displayln with message ending on newline should have 2 newlines"
   "This is my message!\n\n"
   (call-with-output-string
     (lambda (port)
       (displayln "This is my message!\n" port)))))

(test-end "display-utils-test")
